<template>
  <div class="app-container">
    <div class="nav-container">
      <el-row>
        <el-col :span="4">
          <div class="grid-content bg-purple first" @click="toggleTabs('archives')">
            <img :src='srcList1.archives' alt=""></div>
        </el-col>
        <el-col :span="4">
          <div class="grid-content bg-purple" @click="toggleTabs('personrequire')">
            <img class="img" :src='srcList1.personrequire' alt=""></div>
        </el-col>
        <el-col :span="4">
          <div class="grid-content bg-purple" @click="toggleTabs('recruitfeedback')">
            <img :src='srcList1.recruitfeedback' alt=""></div>
        </el-col>
        <el-col :span="4">
          <div class="grid-content bg-purple" @click="toggleTabs('certificates')">
            <img class="imghover" :src='srcList1.certificates' alt=""></div>
        </el-col>
        <el-col :span="4">
          <div class="grid-content bg-purple" @click="toggleTabs('security')">
            <img :src='srcList1.security' alt=""></div>
        </el-col>
        <el-col :span="4">
          <div class="grid-content bg-purple" @click="toggleTabs('personchange')">
            <img :src='srcList1.personchange' alt=""></div>
        </el-col>
      </el-row>
    </div>
    <component class="app-container-component" :is="currentView" keep-alive></component>
  </div>
</template>

<script>
  import archives from './components/archives'
  import certificates from './components/certificates'
  import personchange from './components/personchange'
  import personrequire from './components/personrequire'
  import recruitfeedback from './components/recruitfeedback'
  import security from './components/security'

  export default {
    data() {
      return {
        srcList: {
          archives: require('../../../assets/per_images/archives2.png'),
          personrequire: require('../../../assets/per_images/require.png'),
          recruitfeedback: require('../../../assets/per_images/back.png'),
          certificates: require('../../../assets/per_images/certificate.png'),
          security: require('../../../assets/per_images/security.png'),
          personchange: require('../../../assets/per_images/perchange.png')
        },
        srcList1: {},
        archives: 'archives',
        personrequire: 'personrequire',
        recruitfeedback: 'recruitfeedback',
        currentView: 'archives' // 默认选中first子组件
      }
    },
    components: {
      archives,
      certificates,
      personchange,
      personrequire,
      recruitfeedback,
      security
    },
    methods: {
      toggleTabs(tabText) {
        this.currentView = tabText
        this.srcList1 = JSON.parse(JSON.stringify(this.srcList))
        // this.srcList1
        for (const i in this.srcList1) {
          if (i === tabText) {
            this.srcList1.archives = require('../../../assets/per_images/archives.png')
            this.srcList1[i] = require('../../../assets/per_images/' + tabText + '2.png')
          }
        }
      }
    },
    created() {
      this.srcList1 = this.srcList
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  img {
    width: 100%;
    transition: all .2s;
    height: 75px;
  }

  img:hover {
    width: 102%;
    height: 102%;
  }

  .img:hover {
    width: 101%;
  }

  .imghover:hover {
    width: 101%;
  }

  .el-row {
    margin-bottom: 20px;
    &:last-child {
      margin-bottom: 0;
    }
  }

  .distant {
    margin-bottom: 8px;
  }

  .bg-purple-dark {
    background: #99a9bf;
  }

  .bg-purple {
    background: #1D94FB;
  }

  .first {
    background: #FDBD4C;
  }

  .bg-purple-light {
    background: #e5e9f2;
  }

  .grid-content {
    margin: 5px;
    color: white;
    line-height: 75px;
    text-align: center;
    height: 75px;
    min-height: 36px;
  }

  .nav-container {
    margin: 10px;
    display: inline-block;
    -moz-box-shadow:2px 2px 5px #7E8085;
    -webkit-box-shadow:2px 2px 5px #7E8085;
    box-shadow:2px 2px 5px #7E8085;
  }

  .app-container {
    padding: 0;
    .app-container-component {
      height: calc(100vh - 268px);
      margin: 0 20px;
    }
    .el-pagination {
      margin-top: 20px;
    }
    .table-btn {
      margin-bottom: 10px;
      & > button {
        margin: 0 20px;
      }
      .el-dialog {
        textarea {
          margin-top: 10px;
        }
        .el-checkbox {
          margin-right: 20px;
        }
        .el-checkbox + .el-checkbox {
          margin-left: 0;
        }
      }
    }
  }

</style>


<style rel="stylesheet/scss" lang="scss">
  .bigdialog {
    height: 600px;
  }

  .el-input__icon {
    line-height: 100%;
  }

  .el-form-item__content {
    line-height: 33px;
  }

  .area-select .area-selected-trigger {
    padding: 0 10px;
  }

  /*.el-table__body tr.hover-row>td {
    background-color: #0000ff !important;
  }

  .el-table__body tr.current-row>td {
    background-color: #0000ff !important;
  }*/
</style>
